<?php
require_once("./DButil.php");
header("Content-Type:application/json;charset=utf-8");

$arr=$_SESSION["loginTeacher"];

$teacherId=$_REQUEST["id"];
$roleId=$_REQUEST["roleId"];

if ($arr["roleId"] > $roleId) {
    $result = [
        "msg" => "权限不够，禁止修改",
        "code" => 400,
        "success" => false
    ];
    echo json_encode($result);
    return;
}


$sql="update t_teacher set password='000000' where teacherId={$teacherId}";

$add=update($sql);
if ($add) {
    $result = [
        "msg" => "修改成功",
        "code" => 200,
        "success" => true
    ];
}else{
    $result = [
        "msg" => "修改失败",
        "code" => 400,
        "success" => false
    ];
}


echo json_encode($result);

?>